PM_FUNC_NORM_ATTRIB SKILL:SkillConfuseRay( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Confuse Ray", .Type = TYPE_GHOST, .callTypes = CALL_BIND_DOWN, .PP = 10, .Charges = 15, .DelayTime = 15.0 );
		case CALL_HELP:     return SkillHelp( "Shoots a beam that confuses enemies." );
		case CALL_BIND_DOWN:
		{
			new Coord:cOrigin[3], Coord:cAim[3];
			get_user_origin( id, cOrigin );
			PlayerAimOrigin( id, cAim );

			new Float:fRadius = StatClamp( id, STAT_SPECIAL, 50.0, 150.0 );
			new Int:iMaxDamage = StatClamp( id, STAT_SPECIAL, 5, 10 );

			SkillLineDamage( .attacker = id,
							.cStart = cOrigin,
							.cEnd = cAim,
							.fRadius = fRadius,
							.iMaxDamage = iMaxDamage,
							.flags = AOE_IGNORE_ATTACKER | AOE_VICTIM_TEAM
						);

			EffectBeamEntPoint( .iPlayer = 0,
							.iStartEnt = id,
							.cEnd = cAim,
							.iSprite = SPRITE_TRAIL,
							.iStartFrame = 0,
							.iFrameRate = 10,
							.fLife = 0.1,
							.iLineWidth = floatround( fRadius ),
							.iNoiseAmp = 0,
							.iRed = 255,
							.iGreen = 255,
							.iBlue = 255,
							.iAlpha = 255,
							.iScrollSpeed = 10
						);

			StatusLine( .iInflictorID = id,
						.vStart = CoordToVector( cOrigin ),
						.vEnd = CoordToVector( cAim ),
						.iStatus = STATUS_CONFUSE,
						.fRadius = fRadius,
						.iAmount = 1
						);

			SoundCast( id );

			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillLick( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Lick", .Type = TYPE_GHOST, .callTypes = CALL_BIND_DOWN, .PP = 30, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Damages and may Paralyze enemy." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillNightShade( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Night Shade", .Type = TYPE_GHOST, .callTypes = CALL_EVERY_SECOND|CALL_RESET, .PP = 15, .Charges = 180, .DelayTime = 0.0 );
		case CALL_HELP:     return SkillHelp( "Fade in and out of sight" );
		case CALL_EVERY_SECOND:
		{
			new Int:iMaxAlpha = StatClamp( id, STAT_SPECIAL, 255, 155 );
			new Int:iMinAlpha = StatClamp( id, STAT_SPECIAL, 155, 30 );
			new Int:iAlphaMult = ( iMaxAlpha - iMinAlpha ) / 9;
			new Int:iAlpha;

			new Int:iSkillTime = gSkillVariable[ id ];
			switch( iSkillTime )
			{
				case 0:			iAlpha = iMaxAlpha;
				case 1,19:		iAlpha = iAlphaMult*8 + iMinAlpha;
				case 2,18:		iAlpha = iAlphaMult*7 + iMinAlpha;
				case 3,17:		iAlpha = iAlphaMult*6 + iMinAlpha;
				case 4,16:		iAlpha = iAlphaMult*5 + iMinAlpha;
				case 5,15:		iAlpha = iAlphaMult*4 + iMinAlpha;
				case 6,14:		iAlpha = iAlphaMult*3 + iMinAlpha;
				case 7,13:		iAlpha = iAlphaMult*2 + iMinAlpha;
				case 8,9,11,12:	iAlpha = iAlphaMult + iMinAlpha;
				case 10:		iAlpha = iMinAlpha;
			}
			gSkillVariable[ id ] = ( iSkillTime + 1 ) % 20;

			set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, iAlpha );

			EffectScreenFlash( .iPlayer = id,
								.iRed = 0,
								.iGreen = 0,
								.iBlue = 0,
								.iAlpha = 255 - max( iAlpha, 33 ),
								.fTime = 1.0,
								.iFadeFlags = FFADE_STAYOUT
							);

			return SKILL_USED;
		}
		case CALL_RESET:
		{
			new Int:iAlphaVisibility = 255;
			set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, iAlphaVisibility );
			return SKILL_READY;
		}
	}
	return SKILL_READY;
}

